<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2025/8/29
  Time: 8:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>$Title$</title>
  <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
  <script type="text/javascript">
    $(document).ready(function () {
      //1.发送异步，获得全部数据
      $.get("pro/getAll",function (pros) {
        JSON.stringify(pros);
        $("#pname").empty();
        for (var i = 0; i <pros.length ; i++) {
          $("<option value='"+pros[i].pid+"'>"+pros[i].pname+"</option>").appendTo("#pname");
        }
      })
      //2.点击确定，发送同步请求
      $("[value='确定']").click(function () {
        var pid = $("#pname").val();
        window.location.href="workorderAdd.jsp?pid="+pid;
      })
    })
  </script>
</head>
<body>

<table>
  <caption>企业工单管理系统</caption>
  <tr>
    <td>选择项目</td>
    <td colspan="2">
      <select id="pname"></select>
      <input type="button" value="确定">
    </td>
  </tr>
</table>

</body>
</html>
